using System;
using System.Collections.Generic;
using System.Text;
using Pitoshka.Tools.Helpers.TemplateParser;

namespace test
{
	class Program
	{
		class textClass
		{
			private string _TestString;
			public string TestString
			{
				get { return _TestString; }
				set { _TestString = value; }
			}

			private List<string> _TestCollection = new List<string>();
			public List<string> TestCollection
			{
				get { return _TestCollection; }
				set { _TestCollection = value; }
			}

			private object _testObj;

			public object testObj
			{
				get { return _testObj; }
				set { _testObj = value; }
			}



		}

		static void Main(string[] args)
		{
			try
			{
				textClass t = new textClass();
				t.TestString = "It's work!";
				t.TestCollection.Add("first");
				t.TestCollection.Add("second");

				Parser p = new Parser(
				@"start
##If--textClass.testObj## ##test## ##EndIf--textClass.testObj##
##textClass.TestString####Foreach--textClass.TestCollection##
	--->HiHiHi = ##value.TestString##<---##EndForeach--textClass.TestCollection## 
the end!
					");
				
				p.Variables.Add("test", "safd");
				p.Variables.Add("textClass", t);

				string result = p.Parse();
				Console.WriteLine(result);
			}
			catch (Exception Ex)
			{
				Console.WriteLine(Ex);
			}
			finally
			{
				Console.ReadKey();
			}
			
		}
	}
}
